package com.rongc.client.freight.utils;

import android.content.Context;
import android.graphics.Color;
import android.view.Gravity;

import com.flyco.animation.ZoomEnter.ZoomInEnter;
import com.flyco.animation.ZoomExit.ZoomOutExit;
import com.rongc.client.freight.base.view.widget.BaseMyDialog;


/**
 * Created by Bruce on 2016/12/29.
 */
public class UtilMethod {

    private static BaseMyDialog mProgressDialog = null;
    /*---------------------显示加载对话框------------------------*/
    public static void showProgressDialog(Context context) {
        showProgressDialog(context,"正在为您加载...");
    }

    /*---------------------显示加载对话框------------------------*/
    public static void showProgressDialog(Context context ,String content) {
        mProgressDialog = new BaseMyDialog(context);
        mProgressDialog.setCanceledOnTouchOutside(false);
        mProgressDialog.content(content)
                .isTitleShow(false)
                .contentTextSize(14)
                .contentTextColor(Color.parseColor("#444444"))
                .contentGravity(Gravity.CENTER)
                .showAnim(new ZoomInEnter())
                .dismissAnim(new ZoomOutExit())
                .cornerRadius(8)
                .show();

        mProgressDialog.show();

    }

    /*---------------------隐藏加载对话框------------------------*/
    public static void dismissProgressDialog(Context context) {
//        try {
            if (mProgressDialog != null && mProgressDialog.isShowing()) {
                mProgressDialog.dismiss();
            }
//        }catch (Exception e){
//
//        }
    }
}
